/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package com.crmapi.exceptiion;



import com.crmapi.pojo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * <p>Project: CRMSystem - GlobalException</p>
 * <p>Powered by yzc On 2023-11-15 17:10:44</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
@ControllerAdvice
@ResponseBody
public class GlobalException  {

    //@ExceptionHandler(Exception.class)
    //public Result ex(Exception e){
    //    return new Result(404,"页面丢了",e.toString());
    //}

    @ExceptionHandler(ValidateException.class)
    public Result validator(ValidateException e){
        return  new Result(0,"验证错误",e.getErrors());
    }

}
